#ifndef HTTP_CONNECTION_H
#define HTTP_CONNECTION_H

#include <boost\asio.hpp>
#include <boost\array.hpp>
#include <boost\noncopyable.hpp>
#include <boost\shared_ptr.hpp>
#include <boost\enable_shared_from_this.hpp>


namespace jump{
	namespace server{

		class Connection_Manage;

		class Connection
			:public boost::enable_shared_from_this<Connection>,
			private boost::noncopyable
		{
		public:
			explicit Connection(boost::asio::io_service& arg_ioService,Connection_Manage& arg_conn_manage);

			boost::asio::ip::tcp::socket& socket();

			void start();

			void stop();


		private:

			void handle_write(const boost::system::error_code& arg_ec);

			void handle_read(const boost::system::error_code& arg_ec);

			boost::asio::ip::tcp::socket socket_;

			Connection_Manage& connectionManage_;

			//buffer area

			enum
			{
				MAX_LENGTH = 16
			};

			char buf_[MAX_LENGTH];


		};

		typedef boost::shared_ptr<Connection> connection_ptr;

	}//server

}//jump
#endif//HTTP_CONNECTION_H
